/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package de.koller.million.grid.frame.ply;

import de.koller.million.grid.commands.AddGNode;
import de.koller.million.grid.frame.enc.EncounterFrame;
import de.koller.million.grid.frame.enc.GBar;

/**
 *
 * @author User
 */
public class PlayerFrameComp extends javax.swing.JFrame {
	
	private final PlayerFrame node;
	
	public PlayerFrameComp() {
		node = null;
		initComponents();
	}

	public PlayerFrameComp( PlayerFrame node ) {
		this.node = node;
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings( "unchecked" )
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        hp = new de.koller.million.grid.frame.enc.GBar( node.player.playerStats.hpValue );
        showEnc = new javax.swing.JButton();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        valFood = new javax.swing.JLabel();
        valLife = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        valDamage = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        valSpeed = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE);
        setLocationByPlatform(true);
        setResizable(false);
        setType(java.awt.Window.Type.UTILITY);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        hp.setBackground(new java.awt.Color(204, 204, 204));
        hp.setBarColor(new java.awt.Color(209, 0, 0));
        hp.setBarFontColor(new java.awt.Color(255, 255, 255));

        javax.swing.GroupLayout hpLayout = new javax.swing.GroupLayout(hp);
        hp.setLayout(hpLayout);
        hpLayout.setHorizontalGroup(
            hpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 252, Short.MAX_VALUE)
        );
        hpLayout.setVerticalGroup(
            hpLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 20, Short.MAX_VALUE)
        );

        showEnc.setText("zeige Encounter");
        showEnc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                showEncActionPerformed(evt);
            }
        });

        jPanel1.setLayout(null);

        jLabel1.setText("Leben:");
        jPanel1.add(jLabel1);
        jLabel1.setBounds(0, 10, 80, 14);

        jLabel2.setText("Essen Reg.:");
        jPanel1.add(jLabel2);
        jLabel2.setBounds(0, 40, 80, 14);

        valFood.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        valFood.setText("?");
        jPanel1.add(valFood);
        valFood.setBounds(80, 40, 70, 14);

        valLife.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        valLife.setText("?");
        jPanel1.add(valLife);
        valLife.setBounds(80, 10, 70, 14);

        jLabel4.setText("Schaden:");
        jPanel1.add(jLabel4);
        jLabel4.setBounds(0, 0, 80, 14);

        valDamage.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        valDamage.setText("?");
        jPanel1.add(valDamage);
        valDamage.setBounds(80, 0, 70, 14);

        jLabel5.setText("Angriffe p. sek.:");
        jPanel1.add(jLabel5);
        jLabel5.setBounds(0, 20, 80, 14);

        valSpeed.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
        valSpeed.setText("?");
        jPanel1.add(valSpeed);
        valSpeed.setBounds(80, 20, 70, 14);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(hp, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(showEnc)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 151, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(hp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 73, Short.MAX_VALUE)
                .addComponent(showEnc)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void formWindowClosing( java.awt.event.WindowEvent evt ) {//GEN-FIRST:event_formWindowClosing
		node.closeThis();
	}//GEN-LAST:event_formWindowClosing

	private void showEncActionPerformed( java.awt.event.ActionEvent evt ) {//GEN-FIRST:event_showEncActionPerformed
		node.groot.call( new AddGNode( node.groot.frame, new EncounterFrame( node.player.getEncounter() ) ) );
	}//GEN-LAST:event_showEncActionPerformed

	/**
	 * @param args the command line arguments
	 */
	public static void main( String args[] ) {
		/*
		 * Set the Nimbus look and feel
		 */
		//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
		 * If Nimbus (introduced in Java SE 6) is not available, stay with the
		 * default look and feel. For details see
		 * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
		 */
		try {
			for( javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels() ) {
				if( "Nimbus".equals( info.getName() ) ) {
					javax.swing.UIManager.setLookAndFeel( info.getClassName() );
					break;
				}
			}
		} catch ( ClassNotFoundException ex ) {
			java.util.logging.Logger.getLogger( PlayerFrameComp.class.getName() ).log( java.util.logging.Level.SEVERE, null, ex );
		} catch ( InstantiationException ex ) {
			java.util.logging.Logger.getLogger( PlayerFrameComp.class.getName() ).log( java.util.logging.Level.SEVERE, null, ex );
		} catch ( IllegalAccessException ex ) {
			java.util.logging.Logger.getLogger( PlayerFrameComp.class.getName() ).log( java.util.logging.Level.SEVERE, null, ex );
		} catch ( javax.swing.UnsupportedLookAndFeelException ex ) {
			java.util.logging.Logger.getLogger( PlayerFrameComp.class.getName() ).log( java.util.logging.Level.SEVERE, null, ex );
		}
		//</editor-fold>

		/*
		 * Create and display the form
		 */
		java.awt.EventQueue.invokeLater( new Runnable() {

			public void run() {
				new PlayerFrameComp().setVisible( true );
			}
		} );
	}
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public de.koller.million.grid.frame.enc.GBar hp;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JPanel jPanel1;
    public javax.swing.JButton showEnc;
    public javax.swing.JLabel valDamage;
    public javax.swing.JLabel valFood;
    public javax.swing.JLabel valLife;
    public javax.swing.JLabel valSpeed;
    // End of variables declaration//GEN-END:variables
}
